<template>
	<view>
		<view class="tip">
			<view class="item" @click="openModal('ruyuanxuzhi','入园须知')">
				入园须知
			</view>
			<view class="item" @click="openModal('yingdi_goupiaoxuzhi','购/退票须知')">
				购/退票须知
			</view>
			<view class="item" @click="openModal('yingdi_zhuyishixiang','注意事项')">
				注意事项
			</view>
			<view class="item" @click="openModal1('yingdi_image','营地分布图')">
				营地分布图
			</view>
		</view>
		<u-modal :show="modalShow" :title="title" confirm-text="我已阅读" @confirm="modalShow = false">
			<view class="slot-content">
				<rich-text :nodes="content"></rich-text>
			</view>
		</u-modal>
		<view class="list-1">
			<view class="item" v-for="(item,i) in yingdiList" :key="item.id" @click="$tools.to('/pages/yingdi/yingdi?id=' + item.id)">
				<image class="icon-150" :src="item.image" mode="aspectFill"></image>
				<view class="info flex-1">
					<view class="title">{{item.name}}</view>
					<view class="price">
						￥{{item.money}}元/位
						<view class="del">￥{{item.hx_price}}元/位</view>
					</view>
				</view>
				<view class="blue">
					选位置>>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "n-yingdi",
		data() {
			return {
				yingdiList:[],
				modalShow: false,
				content: '',
				title:''
			};
		},
		mounted() {
			this.getList()
		},
		methods: {
			openModal(name,title) {
				this.$api.getConfig({
					name
				}).then(res => {
					if (res.code == 1) {
						this.content = res.data
						this.title = title
						this.modalShow = true
					} else {
						this.$tools.toast(res.msg)
					}
				})
			},
			openModal1(name,title) {
				this.$api.getConfig({
					name
				}).then(res => {
					if (res.code == 1) {
						uni.previewImage({
							urls:[res.data]
						})
					} else {
						this.$tools.toast(res.msg)
					}
				})
			},
			getList() {
				this.$api.ticketsYingdi().then(res => {
					if (res.code == 1) {
						this.yingdiList = res.data
					} else {
						this.$tools.toast(res.msg)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.slot-content{
		max-height: 70vh;
		overflow-y: scroll;
	}
	.tip {
		color: #3670ef;
		font-size: 30upx;
		@include flex;

		.item {
			margin: 0 20upx;
		}
	}

	.list-1 {
		.item {
			@include flex-between;
			border: 1px solid #eee;
			margin: 20upx;
			.info {
				margin: 0 24upx;
				font-weight: 600;

				.price {
					@include flex;
					font-size: 30upx;
					.del {
						font-weight: 500;
						color: #999;
						text-decoration: line-through;
						font-size: 22upx;
						margin-left: 6upx;
					}
				}
				
			}
			.blue{
				color: #3670ef;
				font-size: 26upx;
				margin-right: 20upx;
			}
		}
	}

	/deep/.u-number-box__input {
		background: #fff !important;
	}
</style>